﻿@model Post
@if (Html.IsRaw())
{
    @(new HtmlString("<div>"))
    <div id="raw_info">
        <div class="role-title">@Model.Title - @ViewBag.Description</div>
        @if (Model.CatalogId.HasValue)
        { 
        <div class="role-body-class">@Model.Catalog.Url.ToLower()</div>
        <div class="role-category">@Model.Catalog.Title</div>
        }
        else
        {
        <div class="role-body-class">home</div>
        }
        <div class="role-head-title">
            <p><h1>@Model.Title</h1></p>
            <p><h3><span class="icon-time icon"></span> Published on @Model.Time.ToString()</h3></p>
        </div>
    </div>
}
    <div class="cont-wrap">
        <div class="grid_9">
            <div class="post">
                <div class="post-body">
                    @Html.Marked(Model.Content)
                </div>
                @if (Html.IsAdmin())
                {
                <div class="post-edit">
                    <p><input id="txtTitle" type="text" placeholder="@SR["Title"]" value="@Model.Title" /></p>
                    <p><input id="txtUrl" type="text" placeholder="URL" value="@Model.Url" /></p>
                    <p>
                        <select id="lstCatalogs">
                            <option value="">未分类</option>
                            @foreach (CatalogViewModel c in ViewBag.Catalogs)
                            {
                                <!option value="@c.Id" @(Model.CatalogId == c.Id ? "selected" : "")>@c.Title</!option>
                            }
                        </select>
                    </p>
                    <p>
                        <div class="markdown-textbox-outer">
                            <textarea id="txtContent" class="markdown-textbox" name="Content" placeholder="Markdown here...">@(new HtmlString(Model.Content))</textarea>
                            <div class="markdown-textbox-bottom">拖拽文件、粘贴文件或<a href="javascript:uploadAttachment();">选择文件</a>以添加附件。</div>
                        </div>                    
                    </p>
                    <form id="frmAjaxUpload">
                        <input type="file" id="uploadFile" name="file" />
                    </form>
                    <p>
                        <input type="text" id="txtTags" placeholder="@SR["Use a ',' to split tags"]" value="@Html.TagSerialize(Model.Tags)" />
                    </p>
                    <p>
                        <input type="checkbox" id="chkIsPage" @(Model.IsPage ? "checked" : "") /> @SR["Is a page"]
                    </p>
                    <p>
                        <input type="button" id="btnSavePost" onclick="savePost('@Model.Url')" value="@SR["Save"]" class="more-link" />
                        <a href="javascript:$('.post-edit').slideUp();$('.post-body').slideDown();" yuuko-static>@SR["Cancel"]</a>
                    </p>
                </div>
                }
            </div>
            <div class="community-sharing">
                <span>@SR["Share to:"]</span> 
                <div class="community-sharing-links">
                    <a href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?showcount=0&desc=&summary=&url=@(Context.Request.Scheme + "://" + Context.Request.Host + Context.Request.Path)&Title=@Model.Title&Site=@("Amamiya Yuuko\'s ebullient future")"><img src="~/assets/Default/images/qzone.png" /></a>
                    <a href="javascript:showQrCode();"><img src="~/assets/Default/images/wechat.png" /></a>
                </div>
            </div>
            <div class="comments">
                <h2>Comments</h2>
                <div id="disqus_thread"></div>
            </div>
        </div>
        <div class="qrcode">
            <div id="qrcode" data-url="@(Context.Request.Scheme + "://" + Context.Request.Host + Context.Request.Path)"></div>
            <span>使用微信扫码</span>
        </div>
        @Html.Partial("Sidebar")
    </div>
@if (Html.IsRaw())
{
    @(new HtmlString("</div>"))
}